﻿using QLXN.Common;
using QLXN.Product;
using QLXN.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLXN
{
    public partial class Main : hTekForm
    {
        private const int CP_NOCLOSE_BUTTON = 0x200;
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ClassStyle = cp.ClassStyle | CP_NOCLOSE_BUTTON;
                return cp;
            }
        }

        public Main()
        {
            InitializeComponent();
        }

        public Main(string username)
        {
            InitializeComponent();
            txt_us.Text = username;
        }

        #region function
        void child_form_closed(object sender, FormClosedEventArgs e)
        {
            this.Show();
        }
        #endregion

        #region menu click
        private void btn_exit_Click(object sender, EventArgs e)
        {
            DialogResult rs = MessageBox.Show(this, "Thoát chương trình?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (rs == DialogResult.Yes)
                this.Close();
        }

        private void btn_products_Click(object sender, EventArgs e)
        {
            ProductList pl = new ProductList(txt_us.Text);
            pl.FormClosed += new FormClosedEventHandler(child_form_closed);
            pl.Show();
            this.Hide();
        }

        private void btn_export_Click(object sender, EventArgs e)
        {

        }

        private void btn_import_Click(object sender, EventArgs e)
        {

        }

        private void btn_manu_Click(object sender, EventArgs e)
        {

        }

        private void btn_store_Click(object sender, EventArgs e)
        {

        }

        private void btn_total_Click(object sender, EventArgs e)
        {

        }

        private void btn_config_Click(object sender, EventArgs e)
        {

        }
        #endregion

        #region menu effect
        private void btn_exit_MouseLeave(object sender, EventArgs e)
        {
            btn_exit.Image = Resources.power;
        }

        private void btn_exit_MouseEnter(object sender, EventArgs e)
        {
            btn_exit.Image = Resources.power_hover;
        }

        private void btn_products_MouseEnter(object sender, EventArgs e)
        {
            btn_products.Image = Resources.inbox_hover;
        }

        private void btn_products_MouseLeave(object sender, EventArgs e)
        {
            btn_products.Image = Resources.inbox;
        }

        private void btn_export_MouseEnter(object sender, EventArgs e)
        {
            btn_export.Image = Resources.chevron_left_hover;
        }

        private void btn_export_MouseLeave(object sender, EventArgs e)
        {
            btn_export.Image = Resources.chevron_left;
        }

        private void btn_import_MouseEnter(object sender, EventArgs e)
        {
            btn_import.Image = Resources.chevron_right_hover;
        }

        private void btn_import_MouseLeave(object sender, EventArgs e)
        {
            btn_import.Image = Resources.chevron_right;
        }

        private void btn_manu_MouseEnter(object sender, EventArgs e)
        {
            btn_manu.Image = Resources.places_hover;
        }

        private void btn_manu_MouseLeave(object sender, EventArgs e)
        {
            btn_manu.Image = Resources.places;
        }

        private void btn_store_MouseEnter(object sender, EventArgs e)
        {
            btn_store.Image = Resources.home_hover;
        }

        private void btn_store_MouseLeave(object sender, EventArgs e)
        {
            btn_store.Image = Resources.home;
        }

        private void btn_total_MouseEnter(object sender, EventArgs e)
        {
            btn_total.Image = Resources.pie_hover;
        }

        private void btn_total_MouseLeave(object sender, EventArgs e)
        {
            btn_total.Image = Resources.pie;
        }

        private void btn_config_MouseEnter(object sender, EventArgs e)
        {
            btn_config.Image = Resources.settings_hover;
        }

        private void btn_config_MouseLeave(object sender, EventArgs e)
        {
            btn_config.Image = Resources.settings;
        }
        #endregion
    }
}
